<script>
    let data = {
        msg: "reflect",
        fn() {
            console.log(this)
        }
    }

    console.log(Reflect.get(data, 'msg')) //相当于data.msg
    Reflect.get(data, 'fn')()


    let arr = [1, 2, 3, 4, 5]

    //这个函数拦截的目标是arr这个数组

    //proxy在vue3里面也是需要进行额外的数组方法的处理

    function reactive(target) {
        let handle = {
            get(target, key, receiver) {
                console.log('arr[' + key + ']被访问了')
                return Reflect.get(target, key, receiver)
            },
            set(target, key, value, receiver) {
                console.log(key + '被设置了')
                console.log('target', target)
                console.log('key', key)
                console.log('value', value)
                Reflect.set(target, key, value, receiver)
            }
        }

        return new Proxy(target, handle)
    }


    let arr2 = reactive(arr)

    //vue3的

</script>